package com.fh.util;

import com.fh.entity.system.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

/**
 * @author Lr
 */
public class SessionUtil {
    /**
     * 得到session
     */
    public static Session getSession() {
        //获取当前session
        Subject currentUser = SecurityUtils.getSubject();
        Session session = currentUser.getSession();
        return session;
    }
    /**
     * 得到sessionUser
     */
    public static User getSessionUser() {
        //获取当前登录用户
        Subject currentUser = SecurityUtils.getSubject();
        Session session = currentUser.getSession();
        User user = (User) session.getAttribute(Const.SESSION_USER);
        return user;
    }
}
